package com.zw.yzk.kabu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zw.yzk.kabu.view.fragment.GoodsOrderFragment;

import java.util.List;

/**
 * Created by zhanwei on 2017/2/8.
 */

public class GoodsOrderFragmentAdapter extends FragmentPagerAdapter {
    private List<GoodsOrderFragment> fragmentList; // Fragment列表
    private List<String> titleList; // Tab名的列表

    public GoodsOrderFragmentAdapter(FragmentManager fm, List<GoodsOrderFragment> listFragment, List<String> listTitle) {
        super(fm);
        this.fragmentList = listFragment;
        this.titleList = listTitle;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return titleList.size();
    }

    // 此方法用来显示Tab上的名字
    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position % titleList.size());
    }
}
